import { App } from 'vue';
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
import {
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
} from 'echarts/components';
import Chart from './chart/index.vue';
import FormPro from './FormPro/index.vue';
import MapContainer from './MapContainer/index.vue';
import PageDetail from './PageDetail/index.vue';
import PageTable from './PageTable/index.vue';
import SearchForm from './SearchForm/index.vue';
import DetailDesc from './DetailDesc/index.vue';
import CTitle from './CTitle/index.vue';
import STitle from './STitle/index.vue';

// Manually introduce ECharts modules to reduce packing size

use([
  CanvasRenderer,
  BarChart,
  LineChart,
  PieChart,
  RadarChart,
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
]);

export default {
  install(Vue: App) {
    Vue.component('Chart', Chart);
    Vue.component('FormPro', FormPro);
    Vue.component('MapContainer', MapContainer);
    Vue.component('PageDetail', PageDetail);
    Vue.component('PageTable', PageTable);
    Vue.component('SearchForm', SearchForm);
    Vue.component('DetailDesc', DetailDesc);
    Vue.component('CTitle', CTitle);
    Vue.component('STitle', STitle);
  },
};
